#ifndef WIIMOTEWIDGET_H
#define WIIMOTEWIDGET_H

#ifdef WIIMOTE

#include "GUI/wiimote/wiimotestatusdialog.h"

/**
  * @brief This is the base class that all widgets that wish to register ownership of the wiimote to lock its input
  * from it should subclass.
  *
  * It is a really simple class, and basically just stores a WiimoteStatusDialog that contains its own qWiimote object.
  * Classes that subclass it should only have to implement associateWiimote(), and link dialogs signals to its internal
  * slots. Changing the association of the WiimoteStatusDialog is handled by WiimoteStatusDialog::associate() (in other
  * words, you shouldn't ever directly call associateWiimote()).
  *
  * At any point, subclasses can check hasWiimoteDialog(), and if so change the associations of input bindings.
  */
class WiimoteWidget {
private:
    WiimoteStatusDialog* _wiimoteDialog;
public:
    explicit WiimoteWidget();

    /**
      * @brief This should be reimplemented to associate commands in dialog with specific slots in the WiimoteWidget.
      *
      * @param dialog
      */
    virtual void associateWiimote(WiimoteStatusDialog* dialog) {}
    /**
      * @brief Associates this widget with a wiimote dialog, and then calls associateWiimote() for subclassed
      * association linkage.
      *
      * NOTE: The only time you should explicitly call this function is from the root widget that will take association
      * of the wiimote, as it will automatically be called by WiimoteStatusDialog::associate() otherwise, and will in
      * that case retain the proper past association stack.
      */
    void setWiimote(WiimoteStatusDialog* dialog);
protected:
    bool hasWiimoteDialog() const;
    WiimoteStatusDialog* getWiimoteDialog();
};

#endif

#endif // WIIMOTEWIDGET_H
